# Author    : CoffeeChicken
# Date      : 2022/1/2 20:58
# Function  : 演示


from __future__ import print_function

import logging

import grpc
import service_pb2
import service_pb2_grpc
import request_pb2 as request__pb2
import response_pb2 as response__pb2


def run():
    # NOTE(gRPC Python Team): .close() is possible on a channel and should be
    # used in circumstances in which the with statement does not fit the needs
    # of the code.
    with grpc.insecure_channel('192.168.43.17:8080') as channel:
        stub = service_pb2_grpc.HospitalServiceStub(channel)
        response = stub.ListHospitals(request__pb2.ListHospitalsRequest())
    print("Greeter client received: " , response.hospitals[20].name)

logging.basicConfig()
run()
